	<div class="page-heading">
            		<h1><i class=' icon-newspaper-1'></i>Notícia General</h1>
            		            	</div>
            	<!-- Page Heading End-->
				
				<!-- Begin Inbox -->
				<div class="box-messages">
						<div class="col-md-3">
							<!-- Sidebar Message -->

							<div class="btn-group new-message-btns stacked">
								<a id="crear_galeria" href="#" class="btn btn-primary btn-lg btn-block text-left"> Crear</a>
							</div>
							<div class="list-group menu-message">
							  <a href="inbox.html" class="list-group-item"><i class="icon-inbox"></i> Inbox <span class="badge pull-right">4</span></a>
							  <a href="#fakelink" class="list-group-item"><i class="icon-pencil"></i> Draft <span class="badge bg-green-1 pull-right">1</span></a>
							  <a href="#fakelink" class="list-group-item"><i class="icon-star"></i> Important <span class="badge bg-red-1 pull-right">2</span></a>
							  <a href="#fakelink" class="list-group-item"><i class="icon-export"></i> Sent</a>
							  <a href="#fakelink" class="list-group-item"><i class="icon-cup"></i> Afegir imatge <span class="badge bg-lightblue-1 pull-right">1</span></a>
							  <a href="#fakelink" class="list-group-item"><i class="icon-cup"></i> Afegir email<span class="badge bg-lightblue-1 pull-right">1</span></a>
							</div>
							
							<div class="list-group menu-folders">
								<div class="col-md-6">
							  		<button class="btn btn-facebook btn-block"><i class="fa fa-facebook"></i> Facebook</button>
							  	</div>
							  	<div class="col-md-6">
							  		<div class="iswitch ios-switch-facebook off"><div class="on-background background-fill"></div><div class="state-background background-fill"></div><div class="handle"></div></div>
								</div>
							  	<div class="col-md-6">
							  		<button class="btn btn-twitter btn-block"><i class="fa fa-twitter"></i> Twitter </button>
							  	</div>
							  	<div class="col-md-6">
							  		<div class="iswitch ios-switch-primary on"><div class="on-background background-fill"></div><div class="state-background background-fill"></div><div class="handle"></div></div>
								</div>
							  	<div class="col-md-6">
							  		<button class="btn btn-google-plus btn-block"><i class="fa fa-google-plus"></i> Google Plus</button>
							  	</div>
							  	<div class="col-md-6">
							 	 	<div class="iswitch ios-switch-danger on"><div class="on-background background-fill"></div><div class="state-background background-fill"></div><div class="handle"></div></div>
							  	</div>
							</div>
							  

							</div>
						</div><!-- ENd div .col-md-2 -->

						<div class="col-md-9">							
								<div class="col-sm-2">
									<div class="widget">
										<div class="btn-group new-message-btns stacked">
											<a href="galerias" class="btn btn-primary btn-lg btn-block text-left">Galeries</a>
										</div>
									</div>
								</div>
								<div class="col-sm-2">
									<div class="widget">
										<div class="btn-group new-message-btns stacked">
											<a href="nova_galeria" class="btn btn-primary btn-lg btn-block text-left">Crear Galeria</a>
										</div>
									</div>
								</div>
								<div class="row" >
                                    <div class="col-sm-12 mail-body" style="margin-bottom: 20px;">
                                        <label>Crear seccio </label><input type="text" name="seccion" autocomplete="off"/><br /><br />
                                        <label>Seccions </label>
                                        <select>
                                            <?php 
                                            
                                                foreach($data['seccions'] as $seccio){
                                                    echo '<option value="'.$seccio->id.'">'.$seccio->nom.'</option>';
                                                }
                                            
                                            ?>
                                        </select>
                                        <div style="display: inline-block;">
                                            <button id="eliminar_seccio" class="btn btn-twitter btn-block"> X </button>
                                        </div>
                                    </div>
										
									</div>
									
								</div>
							</div>
						</div>
					</div>

<script type="text/javascript">
    
    $('#eliminar_seccio').click(function(){
        valor = $('select option:selected').val();
         $.ajax({
                type: "POST",
                url: "eliminar_galeria",
                data: { id: valor, tipo: 'seccion' }
            })
                .done(function( msg ) {

                });
    })
    
    $('#crear_galeria').click(function(e){
            e.preventDefault();
            e.stopPropagation();
            seccion = $('input[name="seccion"').val()
            $.ajax({
                type: "POST",
                url: "crear_seccion",
                data: { seccion: seccion }
            })
                .done(function( msg ) {
                     location.reload();
                });            
        }); 

	$("#plantilla_video").hide();
	$("#plantilla_galeria").hide();
	
	function plantilla_defecto(){
		var ocultar = ["#plantilla_video","#plantilla_galeria"];
		hide(ocultar);
		show(["#plantilla_defecto"]);
	}

	function plantilla_video(){
		var ocultar = ["#plantilla_defecto","#plantilla_galeria"];
		hide(ocultar);
		show(["#plantilla_video"]);
	}

	function plantilla_galeria(){
		var ocultar = ["#plantilla_video","#plantilla_defecto"];
		hide(ocultar);
		show(["#plantilla_galeria"]);
	}

	function hide(val){
		for (div of val) {
			$(div).hide();
		}
	}

	function show(val){
		
		for (div of val) {
			$(div).show();
		}
	}
    
    
     
    
</script>  